@extends('layouts.back_stage')
@section('content')
    <link rel="stylesheet" href="{{env('CDN_DOMAIN_NAME')}}/css/dateSelect.css"/>
    <script src="{{env('CDN_DOMAIN_NAME')}}/js/dateSelect.js"></script>
    <style>
        /*成品入库*/
        .seek_p{width:100%;text-align: center;}
        .seek_lab{width:220px;line-height:30px;margin-right:10px;margin-bottom: 15px;}
        .seek_lab1{width:240px;line-height:30px;margin-right:10px;margin-bottom: 15px;}
        .seek_sel{width:160px;height: 30px;line-height:30px;float:right;outline:none;font-size: 13px;padding:5px 10px;font-weight: normal;border-radius: 2px;color: #555;background:#fff;background-image: none;border: 1px solid #cfdadd;box-shadow: none;}
        .bt_del{text-align: center;display:inline-block;margin-right:10px;}
        .articles-choose{width:100%;line-height:10px;height:10px;margin:20px auto;}
        .articles_div{color:#383838; width:100%;height:auto;}
        .articles{border-collapse:collapse;width:100%;font-size:14px;color:#383838;background:#fff;margin-bottom:10px;}
        .articles td{text-align:center;height:35px;}
        table,th,td{border:1px solid #ccc;}
        ::-webkit-scrollbar{width:10px;height:5px;}
        ::-webkit-scrollbar-track{background-color:#f1f1f1;}
        ::-webkit-scrollbar-thumb{background-color:#ccc;}
        ::-webkit-scrollbar-thumb:hover {background-color:#9c3;}
    </style>
    <div class="container">
        <div style="padding:20px 0;"><h3>成品入库</h3></div>
        <ul class="articles-ul">
            {{--成品入库--}}
            <li class="articles-li">
                <form action="" method="get" >
                    {{ csrf_field() }}
                    <p class="seek_p">
                        <label class="seek_lab">状态：
                            <select class="seek_sel sel"  name="status" >
                                @if($where->status)
                                    @if($where->status == 4)
                                        <option value="4">生产中</option>
                                        @elseif($where->status == 5)
                                        <option value="5">已到库</option>
                                    @endif
                                @endif
                                    <option value="">请选择</option>
                                    <option value="4">生产中</option>
                                    <option value="5">已到库</option>
                            </select>
                        </label>
                        <label class="seek_lab">款号：
                            <input class="address sel" style="width: 160px" type="text" name="girard" placeholder="输入款号" value="{{ $where->girard }}">
                        </label>
                        <label class="seek_lab" >品类：
                            <select class="seek_sel sel" name="cate">
                                @if($where->cate)
                                    <option value="{{ $where->cate }}">{{ $cate[$where->cate] }}</option>
                                    @else
                                @endif
                                    <option value="">请选择</option>
                                @foreach($cate as $k=>$v)
                                    <option value="{{ $k }}">{{ $v }}</option>
                                    @endforeach
                            </select>
                        </label>
                        <label class="seek_lab seek_lab1">投产时间：
                            <input class="address sel" id="date1" style="width: 160px" type="text" readonly name="date" placeholder="输入投产时间" value="{{ $where->date }}">
                        </label>
                        <button type="submit" class="btn bt_del btn-info">搜索</button>
                        <a class="btn bt_del btn-info" href="javascript:;" onclick="emptyArticles()">清空</a>
                    </p>
                </form>
                <div class="articles-choose">
                    <span>共<span class="mate_count">{{ $count }}</span>条信息</span>
                </div>
                <div class="articles_div">
                    <table class="articles" border="1" cellspacing="0" cellpadding="0">
                        <tr>
                            <td>状态</td>
                            <td>计划单号</td>
                            <td>款号</td>
                            <td>品类</td>
                            <td>投产量</td>
                            <td>入库量</td>
                            <td>投产时间</td>
                            <td>入库时间</td>
                            <td>录入人</td>
                            <td style="width:250px;">操作</td>
                        </tr>
                        @if(count($list) > 0)
                            @foreach($list as $v)
                        <tr>
                            <td>
                                @if($v->status == 3)
                                    已投产
                                @elseif($v->status == 4)
                                    生产中
                                @elseif($v->status == 5)
                                    已到库
                                @endif
                            </td>
                            <td>{{ $v->plan_code }}</td>
                            <td>{{ $v->girard }}</td>
                            <td>{{ $cate[$v->cate_id] }}</td>
                            <td>{{$v->total - $v->surplus_pur }}</td>
                            <td>{{$v->storage_volume}}</td>
                            <td>{{$v->investment_at}}</td>
                            <td>{{ str_limit($v->storage_time,10,'') }}</td>
                            <td>{{ $v->user_name }}</td>
                            <td>
                                @if(in_array(Auth::guard('admin')->user()->department_id,[5,9]))
                                <a class="btn btn-info" href="/storage/getClothesInfo?id={{ $v->id }}">成品入库</a>
                                @endif
                                    @if(in_array(Auth::guard('admin')->user()->department_id,[6,9]))
                                    <a class="btn btn-info" href="/storage/getClothsInfo?id={{ $v->id }}">剩余面料入库</a>
                                        @endif
                            </td>
                        </tr>
                            @endforeach
                        @endif
                    </table>
                </div>
            </li>
            <span style="float:right;"><div class="return_box" style="float: right;margin:20px 0;"><button class="btn btn-info" onclick="returnPage()" style="float:right;">跳转</button><input type="text" class="form-control returnPage" style="width:6rem;float: right;margin:0 5px;"></div>{{ $list->appends(['status'=>$where->status,'girard'=>$where->girard,'cate'=>$where->cate,'date'=>$where->date])->links() }}</span>
        </ul>
    </div>
    <script>
        /*日期插件初始化*/
        $("#date1").dateSelect();
        /*清空按钮*/
        function emptyArticles(){
            $(".sel").each(function(){
                $(this).val("");
            })
        }
        $(document).ready(function () {
            if($('.mate_count').text() < 10){
                $('.return_box').hide()
            }else{
                $('.return_box').show()
            }
        })
    </script>
@endsection
